package main

import (
	"net"
	"net/rpc"
)

type HelloWordService struct {
}

func (h *HelloWordService) Hello(request string, reply *string) error {
	*reply = "hello," + request
	return nil
}

func main() {
	listen, err := net.Listen("tcp", ":8088")
	if err != nil {
		panic(err)
	}

	err = rpc.RegisterName("HelloWordService", &HelloWordService{}) // 注册
	if err != nil {
		panic(err)
	}
	accept, err := listen.Accept()
	if err != nil {
		panic(err)
	}
	rpc.ServeConn(accept)
}
